﻿using BellAssistant.DSS;
using BellAssistant.Model.Tables;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BellAssistant.DataManager
{
    public partial class BrandManage : FrmBase
    {
        public BrandManage()
        {
            InitializeComponent();
            btnAdd.Click += btnAdd_Click;
            btnSearch.Click += btnSearch_Click;
        }

        private void btnSearch_Click(object sender, EventArgs e)
        {
            List<Brand> list= CreateDataSourceService.IDataSourceService.GetAllBrand();
            gridControl1.DataSource = list;
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            string brandName = txtBrandName.Text;
            string result=CreateDataSourceService.IDataSourceService.SaveBrand(brandName);
            MessageBox.Show(result, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            btnSearch_Click(sender, e);
        }
    }
}
